package com.liqing.movecomment.util;

import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.read.builder.ExcelReaderBuilder;
import com.alibaba.excel.read.builder.ExcelReaderSheetBuilder;
import java.io.InputStream;
import java.util.List;
import java.util.Objects;


public class ExcelUtils {
    //<editor-fold defaultstate="collapsed" desc="delombok">
    @SuppressWarnings("all")
    private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(ExcelUtils.class);
    //</editor-fold>

    public static <T> List<T> getExcelModelData(final InputStream inputStream, Class<T> clazz) {
        if (Objects.isNull(inputStream)) {
            throw new NullPointerException("输入流不能为空!");
        }
        ExcelReaderBuilder result = EasyExcel.read(inputStream, clazz, null);
        ExcelReaderSheetBuilder sheet1 = result.sheet();
        return sheet1.doReadSync();
    }
}
